1. Technical Field
The present invention relates in general to a method and system for improved data processing and in particular to an improved method and system for data processing within a multiprocessor data processing system. Still more particularly, the present invention relates to an improved method and system for handling exceptions within a multiprocessor data processing system.
2. Description of the Related Art
Data processing systems typically include facilities which enable a processor to interrupt the current thread of processing in response to interrupts generated by external signals and exceptions generated by processing the current thread of execution. An example of an exception is a page fault in a data processing system utilizing a virtual memory system.
In data processing systems having a single processor, interrupts and exceptions are usually handled utilizing a three step process. First, the context of the processor at the time the interrupt or exception was received is stored within temporary storage, such as the processor's internal stack. The processor context includes not only an indication of which instruction within the thread to execute subsequent to handling the interrupt or exception, but also the value of data and status registers within the processor.
After the processor context is saved, the interrupt or exception is mapped to a particular memory address which stores the first instruction of an interrupt or exception handling routine (i.e., interrupt vector) associated with the particular interrupt or exception. The interrupt or exception handler is then executed. Finally, upon completion of the handler, the former context of the processor is restored by loading the processor data and status register values from the temporary storage area. Thereafter, processing of the thread is resumed beginning with the specified instruction.
In general, a similar approach to handling interrupts and exceptions is applicable to multiprocessor data processing systems. However, additional complications arise in a multiprocessor environment due to the ability of a multiprocessor data processing system to execute a number of threads simultaneously. A typical multiprocessor data processing system has both a global and local execution queues. Threads are assigned from the global execution queue to a particular local execution queue associated with a processor on the basis of affinity, that is, threads having a high degree of shared resource utilization are assigned to the same local execution queue.
When an exception occurs on a particular processor within a multiprocessor data processing system, the processor typically follows the three step exception handling process described above. If execution of the thread interrupted by the occurrence of an interrupt or exception cannot continue upon completion of the handler, for example, if execution depends upon a condition precedent that has not occurred, execution of the interrupted thread is suspended and another thread within the local execution queue is selected to run. If no other threads are present within the local execution queue, the processor simply idles until the interrupted thread again becomes executable.
Because of the increased overhead associated with maintaining both global and local execution queues and the inefficiency of conventional multiprocessor data processing systems in maintaining load balancing, some manufacturers, and in particular International Business Machines Corporation, have developed multiprocessor data processing systems which utilize a single global execute queue from which threads are dispatched for execution by multiple processors. Although maintaining a single global execution queue promotes greater efficiency, a problem arises when implementing conventional exception handling techniques in these systems. For example, if a thread that generates an exception is placed in the global execution queue immediately following the exception, the thread might be scheduled on more than one processor at the same time. This potential scheduling conflict arises since threads on the global execution queue can be scheduled at any time by a dispatcher routine running on one of the multiple processors. If the thread interrupted by the exception is in a critical section of code when interrupted by the exception, the thread must be dispatched to maintain data integrity and to ensure that the system does not crash. If a thread in a critical section of code is placed on the global execution queue when the exception is handled and subsequently dispatched to a processor other than the original processor, the thread could then enter a critical section of code and be rescheduled on the processor on which the original exception occurred.
Consequently, it would be desirable to provide a method and system for handling exceptions within a multiprocessor data processing system which utilizes a global execution queue.